package org.dromara.system.utils;

import jodd.util.StringUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum TestEquipmentFieldEnum {

    FIELD1("testEquipmentName","试验设备名称"),
    FIELD3("testEquipmentModel","试验设备型号"),
    FIELD4("testEquipmentNumber","数量"),
    FIELD401("measurementUnit","计量单位");

    private final String field;
    private final String fieldName;

    public static TestEquipmentFieldEnum findByFieldName(String fieldName) {
        if (StringUtil.isBlank(fieldName)) {
            return null;
        }
        for (TestEquipmentFieldEnum type : values()) {
            if (type.fieldName.equals(fieldName.replaceAll("\\s*|\r|\n|\t",""))) {
                return type;
            }
        }
        return null;
    }

}
